import 'package:flutter/material.dart';
import 'package:xiaozhoubg/pages/bloc/blocdocs.dart';
import 'package:xiaozhoubg/pages/book/book_docs.dart';
import '../pages/tabs/bottomtab.dart';
import '../pages/tabs/bookpage.dart';
import '../pages/book/book_catalog.dart';
import '../pages/pubilc/company.dart';

final routes = {
  '/': (context) => BottomTab(),
  '/bookpage': (context) => BookPage(),
  '/company': (context) => CompanyPage(),
  '/bookcatalog': (context,{arguments}) => BookCatalog(arguments:arguments),
  '/bookdocs': (context,{arguments}) => BookDocs(arguments:arguments),
  '/blocdocs': (context,{arguments}) => BlocDocs(arguments:arguments),
};
var onGenerateRoute = (RouteSettings settings) {
  // 统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
